<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8"> <meta name="viewport" content="width=device-width">
    <title>程设大作业2-markdown编辑器</title>
    <meta name="viewport" content="width=device-width,initial-scale=1, shrink-to-fit=no">
    <!-- Bootstrap CSS -->
    <link rel="stylesheet"
          href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.0/dist/css/bootstrap.min.css"
          integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk"
          crossorigin="anonymous">
    <link rel="stylesheet"
          href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/styles/androidstudio.min.css">
<!--    <link rel="stylesheet" href="/web_template_css.css">-->
    <!-- this is highlight.js -->
    <script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
    <script id="MathJax-script" async
            src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js">
    </script>
    <script  src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js"
    integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"
    integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.0/dist/js/bootstrap.min.js"
    integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
    <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/highlight.min.js"></script>
    <style>
      img{
        display: block;
        height: auto;
        max-width: 100%;
      }
    </style>
  </head>
  <body>
    <nav class="navbar navbar-expand-lg navbar-light bg-light">
        <a class="navbar-brand" href="#">kvrmnks</a>
        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
          <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse" id="navbarNav">
          <ul class="navbar-nav">
            <li class="nav-item active">
              <a class="nav-link" href="./../../../../../index.html" target="_self">Home <span class="sr-only">(current)</span></a>
            </li>
            <li class="nav-item">
              <a class="nav-link" href="./../../../../../blog.html">Blog</a>
            </li>
            <li class="nav-item">
              <a class="nav-link" href="./../../../../../about.html">About</a>
            </li>
          </ul>
        </div>
      </nav>



    <div class='container'>
      <p>建一篇blog记录一下进度
<!--more--></p>

<h4>2020-4-28</h4>

<p>起步
试图安装双系统，失败
用虚拟机的Qt有点辣眼睛
简单学了一下Qt基本内容，试了试QSocket</p>

<h4>2020-5-02</h4>

<p>今天又收获了好多好多的坑呢</p>

<h5>markdown-&gt;html</h5>

<p><a href="https://github.com/hoedown/hoedown">https://github.com/hoedown/hoedown</a>
纯c手写，clone之后直接nmake一下，调用方法的话写 hoedown.exe -h 就好啦</p>

<h5>nmake 相关</h5>

<p>这个东西是Vs自带的，也就是说要装一个Vs
用everything 找 nmake.exe
然后注意这个的环境变量设置
要一个INCLUDE和LIB 都找一下
有的可能缺kernel32在LIB下找一下</p>

<h5>webenginewidgets 中的 QWebEngineView</h5>

<p>这个需要编译器是MSVC 2015+大约
然后只需要setHtml + show就好了
别忘记show</p>

<h5>资源文件相关</h5>

<p>资源文件是直接编译进exe的所以只可读
资源文件的格式只有（目前发现）QFile能解析</p>

<h5>资源文件的地址转绝对地址</h5>

<p>建一个虚拟文件目录 QTemporaryDir
const QString tmp = mainDir-&gt;path()+<q>/hoedown.exe</q>;
QFile::copy(<q>:/new/prefix1/project/hoedown.exe</q>,tmp）；
然后把资源目录的文件复制进去
就可以用tmp访问了</p>

<h5>文件读写</h5>

<pre><code class="language-cpp">    QFile out(&quot;dududusdshdksjhdksout.txt&quot;);
    if(out.open(QIODevice::WriteOnly)){
       QTextStream ts(&amp;out);
        ts&lt;&lt;textTextEdit-&gt;toPlainText();
        process-&gt;start(mainDir-&gt;path()+&quot;/hoedown.exe --all-block --all-span --all-flags &quot;+&quot;dududusdshdksjhdksout.txt&quot;);
    }else{
        qDebug(&quot;wrong&quot;);
    }
</code></pre>

<p>##### </p>

<h5>如何调用外部的exe</h5>

<p>QProcess
<a href="https://blog.csdn.net/wzj0808/article/details/79367314">https://blog.csdn.net/wzj0808/article/details/79367314</a></p>

<h5>QProcess 中stdout的文件编码</h5>

<p><a href="https://blog.csdn.net/liukang325/article/details/80986472">https://blog.csdn.net/liukang325/article/details/80986472</a></p>


    </div>
    <script>
      hljs.initHighlightingOnLoad()
    </script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/highlightjs-line-numbers.js/2.5.0/highlightjs-line-numbers.min.js"></script>
  <script>
      hljs.initHighlightingOnLoad();
      hljs.initLineNumbersOnLoad();
  </script>
  </body>
</html>